package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;
import java.util.Set;

@FeignClient("OPENAPI-CACHE")
public interface RedisService {

    @GetMapping("/cache/hgetall/{key}")
    public Map<Object, Object> hgetAll(@PathVariable(value = "key") String key);



    @RequestMapping("/cache/members/{key}")
    public Set<String> members(@PathVariable(value = "key") String key);

    @GetMapping("/cache/save2cache")
    public Boolean set(@RequestParam(value = "key") String key, @RequestParam(value = "value")String value, @RequestParam(value = "expire")long expire);

    @GetMapping("/cache/get")
    public String get(@RequestParam(value = "key")String key);

    @GetMapping("/cache/hincr/{key}/{field}/{incr}")
    public Long hincr(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field,@PathVariable(value = "incr")Long incr);

    @GetMapping("/cache/keys/{partten}")
    Set<String> keys(@PathVariable(value = "partten")  String partten);
}
